//面向对象编程的三角形面积计算程序
// NOLINTBEGIN

#include <cmath>
#include <iostream>
using namespace std;

class triangle {
 public:
  double a;
  double b;
  double c;

  void inputSides() {
    cout << "Please enter the three sides of the triangle:" << endl;
    cout << "Side a: ";
    cin >> a;
    cout << "Side b: ";
    cin >> b;
    cout << "Side c: ";
    cin >> c;
  }

  void determine_triangle() {
    if (!(a + b > c && a + c > b && b + c > a)) {
      cout << "This is not a triangle. Please enter again." << endl;
    }
  }

  void triangle_area() {
    double s    = (a + b + c) / 2;
    double area = sqrt(s * (s - a) * (s - b) * (s - c));
    cout << "The area of the triangle is " << area << endl;
  }

  void outputarea() {
    determine_triangle();
    if (a + b > c && a + c > b && b + c > a) {
      triangle_area();
    }
  }
};

int main() {
  triangle tri1;
  tri1.inputSides();
  tri1.outputarea();
  system("pause");
  return 0;
}
// NOLINTEND